package com.zhongshengnetwork.rightbe.dbservice;

import com.zhongshengnetwork.rightbe.CustomApplication;
import com.zhongshengnetwork.rightbe.common.CommonUtils;
import com.zhongshengnetwork.rightbe.dbmodel.GroupdbModel;
import com.zhongshengnetwork.rightbe.dbmodel.MessageNotifydbModel;

import org.xutils.DbManager;
import org.xutils.ex.DbException;
import org.xutils.x;

/**
 * Created by zhongsheng-luojianlan on 16/11/14.
 */

public class MessageNotifydbService {
    //插入或者更新数据
    public static boolean saveOrUpdate(MessageNotifydbModel model){
        DbManager db = x.getDb(CustomApplication.daoConfig);
        try {
            db.saveOrUpdate(model);
            return true;
        } catch (DbException e) {
            e.printStackTrace();
            return false;
        }
    }

    //获取数据
    public static MessageNotifydbModel getModel(String userid){
        DbManager db = x.getDb(CustomApplication.daoConfig);
        try {
            MessageNotifydbModel model = db.findById(MessageNotifydbModel.class,userid);
            return model;
        } catch (DbException e) {
            e.printStackTrace();
            return null;
        }
    }

}
